package com.zhuss.controller.food;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.food.order.CancelOrderBo;
import com.zhuss.bean.bo.food.order.FetchOrderBo;
import com.zhuss.bean.bo.food.order.ReceiveOrderBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OrderService;
import com.zhuss.exception.WpsException;
import com.zhuss.food.order.OrderOperateServiceExt;


/**
 * 订单操作 controller
 * @Author zhushanshuo
   @Date 2020/03/18 16:01
 *
 */
  
 
@RestController
@RequestMapping("/order")
public class OrderOperateController extends BaseController {
	
	@Autowired
	@Qualifier("orderOperateService")
	private OrderService<Void, Object> orderOperateService;
	
	@Autowired
	@Qualifier("orderOperateServiceExt")
	private OrderOperateServiceExt orderOperateServiceExt;
	
	/**
	 * 取餐
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/fetch")
    public void fetch(@RequestBody FetchOrderBo bo) throws WpsException {
		
		orderOperateService.fetch(bo);
    }
	
	
	/**
	 * 接单
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/receive")
    public void receive(@RequestBody ReceiveOrderBo bo) throws WpsException {
		
		orderOperateService.receive(bo);
    }
	
	/**
	 * 取消
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/cancel")
    public void cancel(@RequestBody CancelOrderBo bo) throws WpsException {
		
		orderOperateService.cancel(bo);
    }
	
}
